<?php
// +----------------------------------------------------------------------
// | PHP [ JUST YOU ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2017 http://www.jyphp.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: FlyingPig <flyingpigfp@163.com>
// +----------------------------------------------------------------------

namespace App\Http\Controllers;


use App\Common\HttpClient;
use App\Common\Logger;
use App\Common\Tool;
use App\Exceptions\ApiException;
use App\Logic\ClubLogic;
use App\Logic\DemoLogic;
use App\Logic\MiGuLogic;
use App\Logic\SmsLogic;
use App\Logic\WeChatApplyPayCallBackLogic;
use App\Model\User\User;
use App\Model\Vip\VipInfo;
use Flc\Dysms\Client;
use Flc\Dysms\Request\SendSms;
use Illuminate\Database\QueryException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Str;
use Validator;


class Demo extends Base
{

    public static $log_data = [];

    public function index(Request $request)
    {
        $wx_id = 'odgZdwMKnu7M8adwZtsu8-0jBtwk';
        $file  = '/data/cdn_resource/pictures/wx_avater/' . $wx_id . '.jpg';
        $search = array(" ","　","\n","\r","\t");
        $replace = array("","","","","");
        $file = str_replace($search, $replace, $file);

        echo "d:".file_exists($file);
        echo "b".!file_exists($file);
        dump("is_dir".(int)is_dir('/data/cdn_resource/pictures/wx_avater'));
        //       return ['json' => 'value'];
//        return;
//        echo crypt(microtime(),CRYPT_SHA256);return;
//        $url = 'http://thirdwx.qlogo.cn/mmopen/vi_32/x7dO3qq2JzVxwx011En6NjWJ2bibhgWXyl4Qpa6xcdDqicQmmc94b1YzqBib2q1ickZa8tiaKVnZB5yB7e4wgwG3xtg/132';
//        $img = file_get_contents($url);
////        file_put_contents(storage_path('/').'测试.jpg',$img);
//
//        $ch=curl_init();
//        $timeout=5;
//        curl_setopt($ch,CURLOPT_URL,$url);
//        curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
//        curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);//最长执行时间
//        curl_setopt($ch,CURLOPT_TIMEOUT,$timeout);//最长等待时间
//
//        $img=curl_exec($ch);
//        curl_close($ch);
//        file_put_contents(storage_path('/').'测试.jpg',$img);
    }
}